/**
 * Created by sunliang on 2017/4/18.
 */
Ext.define('Admin.view.baseInfo.userBaseInfo',{
  extend:'Ext.container.Container',
  xtype:'userBaseInfo',
  requires: [
    'Admin.store.baseInfo.UserBaseInfo'
  ],
  user:[],
  // controller: 'riverBaseController',
  userCLs:'big-100 small-100',
  layout:'fit',
  items:{
    xtype:'panel',
    layout:'anchor',
    cls:'dashboard-main-chart shadow',
    width:'100%',
    minHeight:760,
    margin:7,
    bodyPadding:7,
    items:[
      {
        xtype:'grid',
        title:'用水户基础信息',
        height:'100%',
        border:true,
        hidden:true,
        margin:'0 0 15 0',
        bind:{
          store:'userBaseInfo'
        },
        reference: 'historyGrid',//添加“reference”配置到表格并用lookupReference方法获取表格组件
        stripeRows:true,//斑马纹效果
        loadMask:true,//loading效果
        multiSelect:false//允许用户在列表中同时选择多个
      },{
          xtype:'panel',
          title:'用水户基础信息',
          height:'100%',
          border:true,
          margin:'0 0 10 0',
      },{
        tbar: [{
          xtype: "textfield",
          maxWidth: 220,
          fieldLabel: "测站名称",
          labelWidth: 60,
          reference: "newproNm"
        },
        {
          xtype: "button",
          text: "查询",
          iconCls: 'x-fa  fa-file-o',
          handler: 'check',
          margin:'0 10 0 10',
          // buttoncolor:'#108ee9',
          //  style: 'background-color:#108ee9; border-radius:4px;-webkit-border-radius: 4px;',
          style: 'border-radius:4px;-webkit-border-radius: 4px;'
        },
        {
          xtype: "button",
          text: "新增",
          iconCls: 'x-fa  fa-file-o',
          handler: 'add',
          // style: 'background-color:#05dd05; border-radius:4px;-webkit-border-radius: 4px;',
          style: 'border-radius:4px;-webkit-border-radius: 4px;'
        },{
          xtype: "button",
          text: "导入",
          iconCls: 'x-fa  fa-file-o',
          handler: 'input',
          // style: 'background-color:#eb9316; border-radius:4px;-webkit-border-radius: 4px;',
          style: 'border-radius:4px;-webkit-border-radius: 4px;'
        },{
          xtype: "button",
          text: "导出",
          iconCls: 'x-fa  fa-file-o',
          handler: 'output',
          // style: 'background-color:#337ab7; border-radius:4px;-webkit-border-radius: 4px;',
          style: 'border-radius:4px;-webkit-border-radius: 4px;'
        }],
        margin:'0 0 10 0'
      },{
        region: 'center',
        itemId: 'card',
        width: '100%',
        layout: 'card',
        items:[{
          extend:'Ext.tab.Panel',
          // xtype;'riverBaseInfoChild',
          //xtype: 'layout-cardtabs',

          border:true,
          style: 'background-color:#dfe8f6; ',
          items:{
            // title: '测站名称',
            xtype:'grid',
            reference: 'userBaseInfoGrid',
            columns: [
              {header: '测站编号', dataIndex: 'id',/** editor: 'textfield' ,*/align:'center',width:'10%'},
              {header: '测站名称', dataIndex: 'name',/** editor: 'textfield' ,*/align:'center',width:'15%'},
              {header: '所在地', dataIndex: 'place', /** editor: 'textfield' ,*/align:'center',width:'20%'},
              {header: '设站年月', dataIndex: 'yearMon', /** editor: 'textfield' ,*/align:'center',width:'10%'},
              {header: '管理单位代码', dataIndex: 'num', /** editor: 'textfield' ,*/align:'center',width:'10%'},
              {header: '时间', dataIndex: 'time', /** editor: 'textfield' ,*/align:'center',width:'20%'},
              {header: '操作', dataIndex: 'operate', /** editor: 'textfield' ,*/align:'center',xtype : 'actioncolumn',width:'14.7%',
                // renderer:function(value,cellmeta){
                //   var returnStr = "<INPUT type='button' value='修改' style='width:60px;' onclick=btnAction()"> " + "<INPUT type='button' value='删除' style='width:60px;margin-left:2px;'>";
                //   return returnStr;
                // }
                items:[
                  {xtype:'button',
                   text:'修改',
                   iconCls: "x-fa fa-search",
                   style: 'border-radius:4px;-webkit-border-radius: 4px;',
                   handler: 'update'
                  },{xtype:'button',
                   text:'删除',
                   iconCls: "x-fa fa-search",
                   style: 'border-radius:4px;-webkit-border-radius: 4px;',
                   handler: 'delete'
                  }]
              }
           ],
           stripeRows: true,
           columnLines: true,
          //  forceFit: true, //表格自适应

          store: {
           type: 'userBaseInfo'
          }
           ,
           bbar:[
             {
               xtype:"pagingtoolbar",
               store:{
                  type: 'userBaseInfo'
               },
               autoSync: true,
               autoLoad:true,
               displayInfo: true,
               displayMsg:"显示从第{0}条数据到第{1}条数据，共{2}条数据",
               emptyMsg: "没有记录"
            }
          ],
           plugins: {
             ptype: 'cellediting',
             clicksToEdit: 1
           }
         }
        }]
      }
    ]
  }
})
